// 导出员工的excel /sys/user/export
import request from '@/utils/request'
export const getUserExport = () => {
  return request({
    method: 'GET',
    url: '/sys/user/export',
    responseType: 'blob'
  })
}

// 获取-员工列表 /sys/user
export const getUser = (params) => {
  return request({
    method: 'GET',
    url: '/sys/user',
    params
  })
}

// 删除-员工
export const delSysUser = id => {
  return request({
    method: 'DELETE',
    url: `/sys/user/${id}`
  })
}

// 批量-下载导入员工模板 /sys/user/import/template
export const getUserImportTemplate = () => {
  return request({
    method: 'GET',
    url: '/sys/user/import/template',
    responseType: 'blob'
  })
}

// 批量-导入员工(上传excel)
export const postUserImport = (data) => {
  return request({
    method: 'POST',
    url: '/sys/user/import',
    data
  })
}

// 新增-员工
export const postSysUser = (data) => {
  return request({
    method: 'POST',
    url: '/sys/user',
    data
  })
}

// 获取-员工-基本信息
export const getUserId = (id) => {
  return request({
    method: 'GET',
    url: `/sys/user/${id}`
  })
}

// 修改-员工-基本信息 /sys/user/{id}
export const postSysUserId = (data, id) => {
  return request({
    method: 'PUT',
    url: `/sys/user/${id}`,
    data
  })
}

// 获取-已启用的角色列表 /sys/role/list/enabled
export const getSysRoleListEnabled = () => {
  return request({
    method: 'GET',
    url: '/sys/role/list/enabled'
  })
}

// 获取-角色详情 /sys/role/{id}
export const getSysRoleId = (id) => {
  return request({
    method: 'GET',
    url: `/sys/role/${id}`
  })
}

// 分配-员工-角色 /sys/user/assignRoles
export const putSysUserAssignRoles = (data) => {
  return request({
    method: 'PUT',
    url: '/sys/user/assignRoles',
    data
  })
}
